<template>
  <view class="last_record">
    <view class="title">
      <view :style="!isCorrection ? 'border-left: 4rpx solid #0091ff; padding-left: 10rpx' : ''">维保历史</view>
      <view class="more" @click="toInfo" v-if="msg.desc">
        更多记录
        <uni-icons color="#666" size="16" type="arrowright"></uni-icons>
      </view>
    </view>
    <view v-if="msg.typeStatus" class="typeStatus">
      <view class="des">
        <!-- {{Object.keys(msg).length}} -->
        {{
          ["保养", "维修", "救援", "配件", "事务", "质检",'整改','整改','整改'][msg.typeStatus - 1]
        }}
      </view>

      <view class="status">
        <view class="finishtime">完成时间:{{ msg.updateTime }}</view>
      </view>
    </view>
    <view v-else class="empty flex">
      <image src="@/static/images/default.png" mode="" />
      未发现维修/保养记录
    </view>
  </view>
</template>

<script>
import { mapState } from 'vuex';
export default {
  props: {
    msg: {
      type: Object,
    },
    isCorrection: {
      type: Boolean,
      default: false
    }
  },
  components: {
  },
  computed: {
    ...mapState('user', ['userinfo']),
  },
  data() {
    return {};
  },
  methods: {

    // 去历史详情页
    toInfo() {
      const { buildingName, elevatorId, elevatorAddress, planId } = this.msg;
      uni.navigateTo({
        url:
          '/subpages/elevator/projectInfo/eleDetail?id=' +
          elevatorId +
          '&type=' +
          1,
      });
      return;
      let data = {
        name: buildingName,
        // buildingId:this.listObj.buildingId,
        address: elevatorAddress,
        elevatorId: elevatorId,
        planId: planId,
        planStatus: 4,
      };
      console.log('跳转历史记录', data);
      uni.setStorage({
        key: 'statistical',
        data: {
          id: this.userinfo.user_id,
          title:
            this.userinfo.deptNames && this.userinfo.deptNames.length
              ? this.userinfo.deptNames[0]
              : '',
          groupId: this.userinfo.dept_id,
        },
        success: (res) => {
          let str =
            '/pageModules/myElevator/myElevatorInfo?data=' +
            JSON.stringify(data);
          uni.navigateTo({
            url: str,
            fail(err) {
              console.log(err);
            },
          });
        },
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.last_record {
  .empty {
    image {
      width: 64rpx;
      height: 64rpx;
    }

    flex-direction: column;
  }

  .title {
    font-size: 32rpx;
    color: #333;
    font-weight: bold;
    padding-bottom: 22rpx;
    display: flex;
    align-items: center;

    .more {
      display: flex;
      flex: 1;
      padding: 10rpx 0;
      justify-content: flex-end;
      font-size: 24rpx;
      color: #666;
      font-weight: normal;
    }
  }

  .des {
    // margin-bottom: 20rpx;
    font-weight: bold;
    font-size: 28rpx;
    color: #333;
  }

  .imagBox {
    // margin: 20rpx;
    display: flex;
    flex-wrap: wrap;

    image {
      width: 120rpx;
      height: 120rpx;
      margin-right: 18rpx;
    }
  }

  .typeStatus {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .status {
    display: flex;
    font-size: 24rpx;
    // align-items: center;
    // margin: 20rpx 0;

    // view:nth-child(1) {
    //   color: #0091ff;
    //   padding: 4rpx;
    //   background: #daefff;
    //   border-radius: 16rpx;
    // }

    .finishtime {
      color: #999;
      margin-left: 10rpx;
    }
  }
}
</style>
